#include <iostream>
using namespace std;
#include<string>

int main() {
    string str;
    cin >> str;
    string s;
    for (auto& e : str)
    {
        if (s.size() && e == s.back())
        {
            s.pop_back();
        }
        else
        {
            s += e;
        }
    }
    cout << (s.size() == 0 ? "0" : s) << endl;
    return 0;
}